package com.wk.jetpackdemo.db;

import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.wk.jetpackdemo.db.entities.User;

import java.util.List;

@Dao
public interface TestUserDao {
    @Query("SELECT * FROM user")
    LiveData<List<User>> getAllUsers();

    @Update
    void updateUser(User user);

    @Insert
    void insert(List<User> users);

    @Delete
    void deleteItem(User user);

    @Query("UPDATE User SET age=:age WHERE userId=:id")
    void updateAge(int id, int age);
//    @RawQuery
//    List<User> getUsersOnCondition(SupportSQLiteQuery query);
}
